<%@Page Language="VB" %>
<%@Import Namespace="System.Web.Security" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head>
<title>Simple Personalization Example</title>
<style type="text/css">
body {font-family:Tahoma,Arial,sans-serif; font-size:10pt}
input {font-family:Tahoma,Arial,sans-serif; font-size:9pt}
.heading {font-family:Tahoma,Arial,sans-serif; font-size:14pt; font-weight:bold}
.subhead {font-family:Tahoma,Arial,sans-serif; font-size:12pt; font-weight:bold; padding-bottom:5px}
.cite {font-family:Tahoma,Arial,sans-serif; font-size:8pt}
</style></head>
<body bgcolor="<% = strColor %>">
<span class="heading">Simple Personalization Example</span><hr />
<!--------------------------------------------------------------------------->

<div id="msgHello" runat="server" /><p />

<b><ASP:Hyperlink id="lnkUser1" Text="Change Display Settings" NavigateUrl="http://dummy" runat="server" /></b><br />
<b><ASP:Hyperlink id="lnkUser2" Text="Change Sound Options" NavigateUrl="http://dummy" runat="server" /></b><br />
<b><ASP:Hyperlink id="lnkAdmin1" Text="Manage All Users" NavigateUrl="http://dummy" Visible="False" runat="server" /></b><br />
<b><ASP:Hyperlink id="lnkAdmin2" Text="Change Application Settings" NavigateUrl="http://dummy" Visible="False" runat="server" /></b><br />
<b><ASP:Hyperlink id="lnkAdmin3" Text="Display User Session Details" NavigateUrl="http://dummy" Visible="False" runat="server" /></b><br />

<form runat="server">
  <input type="submit" Value="Log Off" runat="server" onserverclick="DoSignOut" /><p />
</form>


<script language="VB" runat="server">

Dim strColor As String

Sub Page_Load()
  If User.Identity.IsAuthenticated Then

    'display welcome message
    msgHello.InnerHtml = "Hello <b>" & User.Identity.Name & "</b>"

    'set preferred background color to the value that was
    'saved in this users Session object by the "login" page
    strColor = Session("BGColor")

    'if user is "sarahware" display admin hyperlinks in page
    If User.Identity.Name = "sarahware" Then
      lnkAdmin1.Visible = True
      lnkAdmin2.Visible = True
      lnkAdmin3.Visible = True
    End If

  Else

    msgHello.InnerHtml = "Hello, you were not authenticated"

  End If
End Sub

Sub DoSignOut(objSender As Object, objArgs As EventArgs)
  FormsAuthentication.SignOut()
  Response.Clear()
  Response.Redirect(Request.UrlReferrer.ToString())
End Sub

</script>

<!--------------------------------------------------------------------------->
<hr /><span class="cite">&copy;2001 <a class="cite" href="http://www.wrox.com/">Wrox Press</a> -
<a class="cite" href="http://www.wrox.com/Books/Book_Details.asp?isbn=1861004885">Professional ASP.NET</a> (ISBN: 1-861004-88-5)</span>
</body>
</html>

